(*************************************************** Ant Movie Catalog importation script www.antp.be/software/moviecatalog/ [Infos] Authors=O Guardião Title=e-Pipoca Description=Movie importation script for e-Pipoca Site=www.epipoca.com.br Language=PT Version=1.1 (24 Maio 2005) Requires=3.5.0 Comments=Caso detectem erros coloquem-nos no meu site: www.guardiao.pt.vu ou enviem para o email: bruno_mga@hotmail.com License=This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. | GetInfo=1 [Options] ***************************************************) program EPipoca; uses StringUtils1; var MovieName: string; MovieURL: string; function HTMLRemove(Value: String): String; begin HTMLDecode(Value); HTMLRemoveTags(Value); Value := Trim(Value); result := Value; end; procedure AnalyzeFilmPage(Address: String); var Page : TStringList; nome_orig, ano, value : string; LineNr, BeginPos, EndPos: Integer; begin Page := TStringList.Create; Page.Text := GetPage(Address); SetField(fieldURL, Address); value:=Page.Text; BeginPos:= pos('
(',value)+15; value:=Copy(value,BeginPos,Length(value)); EndPos := pos('', value); nome_orig:=copy(value,1,EndPos-1); SetField(fieldOriginalTitle, nome_orig); BeginPos:=Pos(')',value); ano:=copy(value,BeginPos-4,4); SetField(fieldYear, ano); if Copy(value,BeginPos-6,1) =',' then begin value:=Copy(value,EndPos+6,BeginPos-EndPos-12); SetField(fieldCountry, value); end; value := TextBetween(Page.Text,'Duração: ',' min
'); SetField(fieldLength,value); LineNr := FindLine('Distribuidora',Page,0); if LineNr<>-1 then begin value := Page.GetString(LineNr+2); EndPos:=Pos('
',value); value :=Copy(value,1,EndPos-1); SetField(fieldProducer,value); end; LineNr := FindLine('', Page, 0)+1; if LineNr<>0 then begin value := Page.GetString(LineNr); BeginPos := pos('', value)+18; EndPos := pos('',value); value:=Copy(value,1,EndPos); value:=HTMLRemove(value); SetField(fieldTranslatedTitle, value); end value := TextBetween(Page.Text,'Gênero: ', '
'); SetField(fieldCategory, value); value := TextBetween(Page.Text,'Diretor(es):','
'); value:=HTMLRemove(value); value:=copy(value,5,length(value)); SetField(fieldDirector, value); value := TextBetween(Page.Text,'Elenco:','mais...'); value:=HTMLRemove(value); value:=copy(value,5,length(value)-7); SetField(fieldActors, value); value := TextBetween(Page.Text,'Sinopse
',''); SetField(fieldDescription, value); value := TextBetween(Page.Text,' ',''); SetField(fieldRating, value); end; procedure AnalyzePage(Address: string); var Page: TStringList; LineNr, StartPos, EndPos: Integer; Line: string; BeginPos,x:integer; MovieAddress, findMovieName,linedown : string; url, nome_filme:string; begin PickTreeClear; Page := TStringList.Create; Page.Text := GetPage(Address); if (pos('
Nenhuma ocorrência com a palavra', Page.Text)=0) then begin repeat LineNr := FindLine('',line)-1; url:=Copy(line,0,EndPos); line:=Copy(line,EndPos+2,length(line)); BeginPos:=Pos('">',line)+2; EndPos:=Pos('
',line); line:=Copy(line,BeginPos,EndPos-BeginPos); PickTreeAdd(line, 'http://epipoca.cidadeinternet.com.br/filmes_zoom.cfm?id'+url); until (line=''); if PickTreeExec(Address) then AnalyzeFilmPage(Address); Page.Free; end else showmessage('Filme não encontrado'); end; begin PickListClear; MovieName := GetField(fieldOriginalTitle); if Input('Importar do e-Pipocat', 'Escreva o nome do filme:', MovieName) then AnalyzePage('http://epipoca.cidadeinternet.com.br/search/index.cfm?busca='+URLencode(MovieName)); end.